<?php
require_once CHEMIN_MODELE . 'Mail.php';
/**
 * Description of MailManager
 *
 * @author Yahn_V
 */
class MailManager {

    public static function getLesMails($loginUser) {
        try {
            $pdo = PDO2::getInstance();
            $requete = $pdo->prepare("SELECT * FROM Mail WHERE login = :login");
            $requete->bindValue(':login',$loginUser);
            $requete->execute();
            $tableauMail = array();
            while ($donnees = $requete->fetch(PDO::FETCH_OBJ)) {
                $mail = new Mail($donnees->mail, $donnees->type);
                $tableauMail[] = $mail;
            }
        } catch (PDOException $e) {
            echo $e->getMessage();
        }

        return $tableauMail;
    }

}

?>
